<template>
    <div>
        这是子组件{{ title }}{{ cc }}
        父组件传的值{{ data.cc }}
        <button @click="bb">子组件按钮{{  cc}}</button>

       <sonComponents></sonComponents>
        
    </div>
</template>

<script setup lang="ts">
import sonComponents from "./sonComponents.vue"
import { inject, onMounted, provide, reactive } from "vue";
const data=reactive({
    cc:0
})


// 父传子  接收父值
defineProps({
    title:String,
    cc:String
})

// 子传父  发送子值  start 
const aa=defineEmits(["cl"]);
const bb=()=>{
    aa("cl",99999);
}
// 子传父  发送子值  end


provide("dd","这是孙子组件的值2333333333333333")
const cc=inject("cc")
console.log(cc,"oppp");


onMounted(()=>{
 
   console.log(cc,"kkkkkkkkkkkkkk");
   
    
})
</script>

<style scoped>

</style>